from manimlib import *
import sys

sys.path.append("../..")
from customized import *
#75cfb8
#bbdfc8
#f0e5d8
#ffc478
class p1(Scene):
    def construct(self):
        # self.add(NumberPlane())
        arc=CustomizedArc(0,PI,radius=6).shift(DOWN*3)
        o,a,b=[-4,-3,0],[4,-3,0],[-3,3,0]
        oa,ob,ab=CustomizedLine(o,a),CustomizedLine(o,b),CustomizedLine(a,b)
        c,d,e,f,g,h=oa.point_from_proportion(0.25),oa.point_from_proportion(0.75),ab.point_from_proportion(0.2),ab.point_from_proportion(0.8),ob.point_from_proportion(2/3),ob.point_from_proportion(1/3),
        ch,de,fg=CustomizedLine(c,h),CustomizedLine(d,e),CustomizedLine(f,g)
        #
        p=CustomizedPolygon(o,a,b)
        pp=CustomizedPolygon(c,d,e,f,g,h).set_fill('#75cfb8',1)
        self.add(pp,p,ch,de,fg)
        t1,t2,t3=CustomizedTex('10').next_to((c+d)/2,DOWN),CustomizedTex('15').next_to((e+f)/2,UR),CustomizedTex('5').next_to((g+h)/2,LEFT)
        t4,t5,t6,t7,t8,t9=CustomizedTex('5').next_to((o+c)/2,DOWN),CustomizedTex('5').next_to((d+a)/2,DOWN),CustomizedTex('5').next_to((a+e)/2,UR),CustomizedTex('5').next_to((f+b)/2,UR),CustomizedTex('5').next_to((b+g)/2,LEFT),CustomizedTex('5').next_to((o+h)/2,LEFT),
        self.add(t1,t2,t3,t4,t5,t6,t7,t8,t9)
        self.wait()
class p2(Scene):
    def construct(self):
        # self.add(NumberPlane())
        arc=CustomizedArc(0,PI,radius=6).shift(DOWN*3)
        o,a,b=[-4,-3,0],[4,-3,0],[-4,3,0]
        oa,ob,ab=CustomizedLine(o,a),CustomizedLine(o,b),CustomizedLine(a,b)
        c,d,e,f,g,h=oa.point_from_proportion(0.25),oa.point_from_proportion(0.75),ab.point_from_proportion(0.2),ab.point_from_proportion(0.8),ob.point_from_proportion(2/3),ob.point_from_proportion(1/3),
        ch,de,fg=CustomizedLine(c,h),CustomizedLine(d,e),CustomizedLine(f,g)
        #
        p=CustomizedPolygon(o,a,b)
        pp=CustomizedPolygon(c,d,e,f,g,h).set_fill('#75cfb8',1)
        self.add(pp,p,ch,de,fg)
        #
        t1,t2,t3=CustomizedTex('10').next_to((c+d)/2,DOWN),CustomizedTex('15').next_to((e+f)/2,UR),CustomizedTex('5').next_to((g+h)/2,LEFT)
        t4,t5,t6,t7,t8,t9=CustomizedTex('5').next_to((o+c)/2,DOWN),CustomizedTex('5').next_to((d+a)/2,DOWN),CustomizedTex('5').next_to((a+e)/2,UR),CustomizedTex('5').next_to((f+b)/2,UR),CustomizedTex('5').next_to((b+g)/2,LEFT),CustomizedTex('5').next_to((o+h)/2,LEFT),
        self.add(t1,t2,t3,t4,t5,t6,t7,t8,t9)
        #
        self.add(Angle(oa,ob,elbow=True))
        self.wait()
class p3(Scene):
    def construct(self):
        # self.add(NumberPlane())
        arc=CustomizedArc(0,PI,radius=6).shift(DOWN*3)
        o,a,b=[-4,-3,0],[4,-3,0],[-4,3,0]
        oa,ob,ab=CustomizedLine(o,a),CustomizedLine(o,b),CustomizedLine(a,b)
        c,d,e,f,g,h=oa.point_from_proportion(0.25),oa.point_from_proportion(0.75),ab.point_from_proportion(0.2),ab.point_from_proportion(0.8),ob.point_from_proportion(2/3),ob.point_from_proportion(1/3),
        ch,de,fg=CustomizedLine(c,h),CustomizedLine(d,e),CustomizedLine(f,g)
        #
        p=CustomizedPolygon(o,a,b)
        pp=CustomizedPolygon(c,d,e,f,g,h).set_fill('#75cfb8',1)
        self.add(pp,p,ch,de,fg)
        #
        t1,t2,t3=CustomizedTex('10').next_to((c+d)/2,DOWN),CustomizedTex('15').next_to((e+f)/2,UR),CustomizedTex('5').next_to((g+h)/2,LEFT)
        t4,t5,t6,t7,t8,t9=CustomizedTex('5').next_to((o+c)/2,DOWN),CustomizedTex('5').next_to((d+a)/2,DOWN),CustomizedTex('5').next_to((a+e)/2,UR),CustomizedTex('5').next_to((f+b)/2,UR),CustomizedTex('5').next_to((b+g)/2,LEFT),CustomizedTex('5').next_to((o+h)/2,LEFT),
        self.add(t1,t2,t3,t4,t5,t6,t7,t8,t9)
        #
        self.add(Angle(oa,ob,elbow=True))
        #
        print(f,e)
        ff,ee=[-4,1.8,0],[2.4,-3,0]
        hf,he=CustomizedLine(f,ff),CustomizedLine(e,ee)
        self.add(
            Angle(CustomizedLine(ff,h),CustomizedLine(ff,f),elbow=True),
            Angle(CustomizedLine(ee,a),CustomizedLine(ee,e),elbow=True),
            hf,he)

        self.wait()